<?php

declare(strict_types=1);
/**
 * This file is part of MineAdmin.
 *
 * @link     https://www.mineadmin.com
 * @document https://doc.mineadmin.com
 * @contact  root@imoi.cn
 * @license  https://github.com/mineadmin/MineAdmin/blob/master/LICENSE
 */

namespace App\Http\Admin\Request\Course;

use App\Schema\Course\CourseSchema;
use Hyperf\Validation\Request\FormRequest;
use Mine\Swagger\Attributes\FormRequest as FormRequestAnnotation;

#[FormRequestAnnotation(
    schema: CourseSchema::class,
    title: '创建课程',
    required: [
        'name'
    ],
    only: [
        'name'
    ]
)]
class CourseRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'title' => 'required|string|max:20',
            'introduce' => 'required',
            'score_option' => 'required',
            'thumb' => 'required',
            'is_publish' => 'required',
            // 'tag_ids' => 'required|array',
            // 'category_ids' => 'required|array'
        ];
    }

    public function attributes(): array
    {
        return [
            'title' => trans('course.title'),
            'introduce' => trans('course.introduce'),
            'score_option' => trans('course.score_option'),
            'thumb' => trans('course.thumb'),
            'is_publish' => trans('course.is_publish'),
            'tag_ids'=>trans('course-tag.title'),
            'category_ids'=>trans('course-category.title')
        ];
    }
}
